<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>
</body>
<script src="./js/vue.js"></script>
<script src="./js/axios.js"></script>
<script>
    let App={
        template:`
            <div>
                <button @click='getData'>发送请求</button>
            </div>
        `,
        methods:{
            getData(){
                axios.get('/user', {
                    params: {
                    ID: 12345
                    }
                })
                .then(function (response) {
                    console.log(response);
                })
                .catch(function (error) {
                    console.log(error);
                });
            }
        }
    }
    // 组件内的每一个this对象，都是Vue的孩子
    // Vue祖宗的原型数据，就会共享给所有的孩子

    Vue.prototype.$axios=axios;

    new Vue({
        el:'#app',
        components:{
            App
        },
        template:"<app/>"
    })


</script>
</html>